<template>
  <NavBar :showLeft="false" title="码上刷题"></NavBar>
  <view class="content"> 
      <view class="uni-margin-wrap">
        <swiper class="swiper-box" indicator-dots="true" autoplay="true" interval="2000" duration="500">
          <swiper-item v-for="(item, index) in carouselList" :key="index" class="swiper-item">
            <img :src="proxy.Api.domain+proxy.Api.imageUrl+item.imgPath"
              @click="jumpOuterPage"
              :style="{width: '100%'}"
              mode="aspectFill"
            >
				  </swiper-item>
        </swiper>
      </view>
      <view class="quick-list">
        <view class="quick-item">
          <view class="title">搜索入口</view>
          <view class="summary">支持通过关键词搜索</view>
          <view class="btn">去搜索</view>
        </view>
        <view class="quick-item">
          <view class="title">在线考试</view>
          <view class="summary">考考你学的怎么样？</view>
          <view class="btn">去考试</view>
        </view>
      </view>
      <view class="category-title">题库分类</view>
      <view class="category-list">
          <uni-grid :column="3" :showBorder="false" :square="false">
            <uni-grid-item  class="category-item">

            </uni-grid-item>
          </uni-grid>
      </view>
  </view>
</template>


<script setup>
import { onLoad, onReachBottom } from "@dcloudio/uni-app";
import { request } from "@dcloudio/uni-h5";
import { ref, reactive, getCurrentInstance, nextTick } from "vue"
const { proxy } = getCurrentInstance();

let carouselList = ref([]);
const getCarousel = async()=>{
  let result = await proxy.Request({
   url:proxy.Api.loadCarousel,
   params:{
    showLoading:false
   }
})
if(!result){
  return;
}
carouselList.value = result.data
};

getCarousel();



</script>

<style>
.uni-margin-wrap{
  width: 100%;
  background: #e0e0e0;
  .swiper-box{
      height: 200px;
  }
  .swiper-item{
    justify-content: center;
    align-items: center;
    display: flex;
    height: 200px;
  }
}
.quick-list{
  display: flex;
  margin-top: 20px;
  .quick-item{
    background: #00BFFF;
    width: 100%;
    margin: 0 5px;
    border-radius: 5px;
    padding: 15px;
    color: #fff;
    .title{
      font-weight: 700;
    }
    .summary{
      font-size: 14px;
      margin-top: 2px;
    }
    .btn{
      margin-top: 10px;
      float: left;
      font-size: 12px;
      border-radius: 5px;
      padding: 4px 10px;
      background: #87CEFA;
    }
  }
}
.category-title {
  margin-top: 20px;
  padding-left: 10px;
  font-weight: bolder;
  color: #464646;
}
.category-list {
  margin-top: 10px;
  overflow: hidden;
  padding: 0px 5px 10px 5px;
  .category-item {
    padding: 3px;
    .category-item-inner {
      height: 100px;
      border-radius: 5px;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: bold;
      font-size: 20px;
      overflow: hidden;
    }
  }
}
</style>
